/*
 * MAX7456 osd low level functions library header
 *
 * Written by Florian MAZEN and Pierre COL, 2008-2009
 * <euronym AT free.fr>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef __MAX7456_H__
#define __MAX7456_H__

/* MAX7456 registers */
#define MAX7456_VM0_R 0x80
#define MAX7456_VM0_W 0x00
#define MAX7456_VM1_R 0x81
#define MAX7456_VM1_W 0x01
#define MAX7456_HOS_R 0x82
#define MAX7456_HOS_W 0x02
#define MAX7456_VOS_R 0x83
#define MAX7456_VOS_W 0x03
#define MAX7456_DMM_R 0x84
#define MAX7456_DMM_W 0x04
#define MAX7456_DMAH_R 0x85
#define MAX7456_DMAH_W 0x05
#define MAX7456_DMAL_R 0x86
#define MAX7456_DMAL_W 0x06
#define MAX7456_DMDI_R 0x87
#define MAX7456_DMDI_W 0x07
#define MAX7456_CMM_R 0x88
#define MAX7456_CMM_W 0x08
#define MAX7456_CMAH_R 0x89
#define MAX7456_CMAH_W 0x09
#define MAX7456_CMAL_R 0x8A
#define MAX7456_CMAL_W 0x0A
#define MAX7456_CMDI_R 0x8B
#define MAX7456_CMDI_W 0x0B
#define MAX7456_OSDM_R 0x8C
#define MAX7456_OSDM_W 0x0C
#define MAX7456_RB0_R 0x90
#define MAX7456_RB0_W 0x10
#define MAX7456_RB1_R 0x91
#define MAX7456_RB1_W 0x11
#define MAX7456_RB2_R 0x92
#define MAX7456_RB2_W 0x12
#define MAX7456_RB3_R 0x93
#define MAX7456_RB3_W 0x13
#define MAX7456_RB4_R 0x94
#define MAX7456_RB4_W 0x14
#define MAX7456_RB5_R 0x95
#define MAX7456_RB5_W 0x15
#define MAX7456_RB6_R 0x96
#define MAX7456_RB6_W 0x16
#define MAX7456_RB7_R 0x97
#define MAX7456_RB7_W 0x17
#define MAX7456_RB8_R 0x98
#define MAX7456_RB8_W 0x18
#define MAX7456_RB9_R 0x99
#define MAX7456_RB9_W 0x19
#define MAX7456_RB10_R 0x9A
#define MAX7456_RB10_W 0x1A
#define MAX7456_RB11_R 0x9B
#define MAX7456_RB11_W 0x1B
#define MAX7456_RB12_R 0x9C
#define MAX7456_RB12_W 0x1C
#define MAX7456_RB13_R 0x9D
#define MAX7456_RB13_W 0x1D
#define MAX7456_RB14_R 0x9E
#define MAX7456_RB14_W 0x1E
#define MAX7456_RB15_R 0x9F
#define MAX7456_RB15_W 0x1F
#define MAX7456_OSDBL_R 0xEC
#define MAX7456_OSDBL_W 0x6C
#define MAX7456_STAT 0xA0
#define MAX7456_DMDO 0xB0
#define MAX7456_CMDO 0xC0

/* Code to stop auto-increment mode */
#define MAX7456_END_AUTO_INCREMENT 0xFF

/* Low level registers access (Read and write) */
unsigned char max7456_read_register(unsigned char adress) ;
void max7456_write_register(unsigned char adress, unsigned char value);

/* Write a signle character in auto-increment mode */
inline void max7456_write_autoincrement_byte(unsigned char value) ;

/* Set and unset the OSD CS pin */
inline void max7456_cs_enable(void);
inline void max7456_cs_disable(void);

/* Convert ASCII to OSD default table code */
unsigned char max7456_ascii2osdChars(unsigned char asciiCode) ;

#endif	/* __MAX7456_H__ */
